export default function (data) {
    let initData = data;
    let headerTitle = initData.title ? initData.title : '';
    let leftBtn = initData.leftBtn ? initData.leftBtn : '';
    let leftPath = initData.leftPath ? initData.leftPath : '';
    let rightBtn = initData.rightBtn ? initData.rightBtn : '';
    let rightPath = initData.rightPath ? initData.rightPath : '';
    let style = `
                <style>
                    .commonHeader{
                        width: 100%;
                        height: 1.333rem;
                        background: #008be6;
                        text-align: center;
                        font-size: 0.467rem;
                        color: white;
                        line-height: 1.6rem;
                        position: fixed;
                        top: 0;
                        overflow: hidden;
                        z-index: 999;
                    }
                    .leftBtn{
                        font-size: 0.267rem;
                        float: left;
                        margin-left: 0.333rem;
                        height: 100%;
                    }
                    .rightBtn{
                        font-size: 0.267rem;
                        float: right;
                        margin-right: 0.333rem;
                        height: 100%;
                    }
                </style>
                `
    let html = `
                <div class="commonHeader">
                    <span>${headerTitle}</span>
                </div>
               `
    window.nbasics.differAction(() => {
        if (document.querySelector(".leftBtn")) {
            document.querySelector(".leftBtn").onclick = function () {
                let dataObjCollector = {};
                window.nbasics.touchBack({"path": leftPath, data: JSON.stringify(dataObjCollector)})
            };
        }
        if (document.querySelector(".rightBtn")) {
            document.querySelector(".rightBtn").onclick = function () {
                let dataObjCollector = {};
                window.nbasics.touchBack({"path": rightPath, data: JSON.stringify(dataObjCollector)})
            };
        }
    });
    return (`<div style="width: 100%; height: 1.333rem;z-index: 999">${style}${html}</div>`);
}